#ifndef _LIGHT_H_
#define _LIGHT_H_

#include "../rtCommon/C_Camera.h"

struct SLight
{
    float3 pos;
    float3 dir;

    float4 ambient, diffuse, specular;

    float specular_exp;

    SLight()
    {
        set( dir, 0, 0, -1 );

        set( pos, 0, 1,  0 );

        set( ambient  );
        set( diffuse  );
        set( specular );

        specular_exp = 0.0f;
    }
};

static SLight * Light(SLight * pLight, float3 & pos, float3 & dir)
{
    if (pLight == NULL)
        return NULL;

    pLight->pos = pos;
    pLight->dir = normalize(dir);

    return pLight;
}

static
void Sync(SLight * pLight, C_Camera * pCamera)
{
    pLight->pos = pCamera->Eye();
    pLight->dir = pCamera->Dir();
}

static
void Sync(C_Camera * pCamera, SLight * pLight)
{
    pCamera->Eye(pLight->pos);
    pCamera->Dir(pLight->dir);

    //Update(*pCamera);
}


#endif